package com.zwz.mall.models;

import com.alibaba.fastjson.JSONObject;
import com.zwz.mall.utils.JSONUtils;

import java.io.Serializable;

public class User implements Serializable, ParseResult {


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public String getQqId() {
        return qqId;
    }

    public void setQqId(String qqId) {
        this.qqId = qqId;
    }

    public String getWbId() {
        return wbId;
    }

    public void setWbId(String wbId) {
        this.wbId = wbId;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(String lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Integer getSignIn() {
        return signIn;
    }

    public void setSignIn(Integer signIn) {
        this.signIn = signIn;
    }

    public String getIdNumber() {
        return idNumber;
    }

    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }

    public String getIsMember() {
        return isMember;
    }

    public void setIsMember(String isMember) {
        this.isMember = isMember;
    }

    public String getIsMaster() {
        return isMaster;
    }

    public void setIsMaster(String isMaster) {
        this.isMaster = isMaster;
    }

    public String getMasterInfo() {
        return masterInfo;
    }

    public void setMasterInfo(String masterInfo) {
        this.masterInfo = masterInfo;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public Integer getIsLive() {
        return isLive;
    }

    public void setIsLive(Integer isLive) {
        this.isLive = isLive;
    }

    public Integer getIsFollow() {
        return isFollow;
    }

    public void setIsFollow(Integer isFollow) {
        this.isFollow = isFollow;
    }

    public Integer getFollowNum() {
        return followNum;
    }

    public void setFollowNum(Integer followNum) {
        this.followNum = followNum;
    }

    public Integer getFansNum() {
        return fansNum;
    }

    public void setFansNum(Integer fansNum) {
        this.fansNum = fansNum;
    }

    public Long getRefreshTime() {
        return refreshTime;
    }

    public void setRefreshTime(Long refreshTime) {
        this.refreshTime = refreshTime;
    }

    //    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    //    @ApiModelProperty(value = "头像")
    private String img;

    //    @ApiModelProperty(value = "用户名")
    private String nickname;

    //    @ApiModelProperty(value = "个性签名")
    private String description;
    //    @ApiModelProperty(hidden = true)
//    @JsonIgnore
    private String password;

    //    @JsonIgnore
//    @ApiModelProperty(hidden = true)
    private String salt;

    private String phone;

    //    @ApiModelProperty(value = "0:男 1：女",hidden = true)
    private String sex;

    //    @ApiModelProperty(value = "微信openid",hidden = true)
    private String openId;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        User user = (User) o;

        if (id != null ? !id.equals(user.id) : user.id != null) return false;
        if (img != null ? !img.equals(user.img) : user.img != null) return false;
        if (nickname != null ? !nickname.equals(user.nickname) : user.nickname != null)
            return false;
        if (description != null ? !description.equals(user.description) : user.description != null)
            return false;
        if (password != null ? !password.equals(user.password) : user.password != null)
            return false;
        if (salt != null ? !salt.equals(user.salt) : user.salt != null) return false;
        if (phone != null ? !phone.equals(user.phone) : user.phone != null) return false;
        if (sex != null ? !sex.equals(user.sex) : user.sex != null) return false;
        if (openId != null ? !openId.equals(user.openId) : user.openId != null) return false;
        if (qqId != null ? !qqId.equals(user.qqId) : user.qqId != null) return false;
        if (wbId != null ? !wbId.equals(user.wbId) : user.wbId != null) return false;
        if (email != null ? !email.equals(user.email) : user.email != null) return false;
        if (updateTime != null ? !updateTime.equals(user.updateTime) : user.updateTime != null)
            return false;
        if (createTime != null ? !createTime.equals(user.createTime) : user.createTime != null)
            return false;
        if (lastLoginTime != null ? !lastLoginTime.equals(user.lastLoginTime) : user.lastLoginTime != null)
            return false;
        if (status != null ? !status.equals(user.status) : user.status != null) return false;
        if (username != null ? !username.equals(user.username) : user.username != null)
            return false;
        if (signIn != null ? !signIn.equals(user.signIn) : user.signIn != null) return false;
        if (idNumber != null ? !idNumber.equals(user.idNumber) : user.idNumber != null)
            return false;
        if (isMember != null ? !isMember.equals(user.isMember) : user.isMember != null)
            return false;
        if (isMaster != null ? !isMaster.equals(user.isMaster) : user.isMaster != null)
            return false;
        if (masterInfo != null ? !masterInfo.equals(user.masterInfo) : user.masterInfo != null)
            return false;
        if (token != null ? !token.equals(user.token) : user.token != null) return false;
        if (isLive != null ? !isLive.equals(user.isLive) : user.isLive != null) return false;
        if (isFollow != null ? !isFollow.equals(user.isFollow) : user.isFollow != null)
            return false;
        if (followNum != null ? !followNum.equals(user.followNum) : user.followNum != null)
            return false;
        if (fansNum != null ? !fansNum.equals(user.fansNum) : user.fansNum != null) return false;
        return refreshTime != null ? refreshTime.equals(user.refreshTime) : user.refreshTime == null;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (img != null ? img.hashCode() : 0);
        result = 31 * result + (nickname != null ? nickname.hashCode() : 0);
        result = 31 * result + (description != null ? description.hashCode() : 0);
        result = 31 * result + (password != null ? password.hashCode() : 0);
        result = 31 * result + (salt != null ? salt.hashCode() : 0);
        result = 31 * result + (phone != null ? phone.hashCode() : 0);
        result = 31 * result + (sex != null ? sex.hashCode() : 0);
        result = 31 * result + (openId != null ? openId.hashCode() : 0);
        result = 31 * result + (qqId != null ? qqId.hashCode() : 0);
        result = 31 * result + (wbId != null ? wbId.hashCode() : 0);
        result = 31 * result + (email != null ? email.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (lastLoginTime != null ? lastLoginTime.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (username != null ? username.hashCode() : 0);
        result = 31 * result + (signIn != null ? signIn.hashCode() : 0);
        result = 31 * result + (idNumber != null ? idNumber.hashCode() : 0);
        result = 31 * result + (isMember != null ? isMember.hashCode() : 0);
        result = 31 * result + (isMaster != null ? isMaster.hashCode() : 0);
        result = 31 * result + (masterInfo != null ? masterInfo.hashCode() : 0);
        result = 31 * result + (token != null ? token.hashCode() : 0);
        result = 31 * result + (isLive != null ? isLive.hashCode() : 0);
        result = 31 * result + (isFollow != null ? isFollow.hashCode() : 0);
        result = 31 * result + (followNum != null ? followNum.hashCode() : 0);
        result = 31 * result + (fansNum != null ? fansNum.hashCode() : 0);
        result = 31 * result + (refreshTime != null ? refreshTime.hashCode() : 0);
        return result;
    }

    //    @ApiModelProperty(value = "qq授权id",hidden = true)
    private String qqId;

    //    @ApiModelProperty(value = "微博授权id",hidden = true)
    private String wbId;

    //    @ApiModelProperty(value = "邮箱")
    private String email;

    //    @ApiModelProperty(value = "更新时间",hidden = true)
//    @JsonIgnore
//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private String updateTime;

    //    @ApiModelProperty(value = "创建时间",hidden = true)
//    @JsonIgnore
//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private String createTime;

    //    @ApiModelProperty(value = "最后登录时间",hidden = true)
//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private String lastLoginTime;

    //    @ApiModelProperty(value = "0:正常 1：锁定")
//    @JsonIgnore
    private String status;

    //    @ApiModelProperty(value = "姓名")
    private String username;

    //    @ApiModelProperty(value = "签到天数")
    private Integer signIn;

    //    @ApiModelProperty(value = "身份证号码")
    private String idNumber;

    //    @ApiModelProperty(value = "是否实名 0:否 1：是")
    private String isMember;

    //    @ApiModelProperty(value = "是否在vip 0:否 1：是2 ;审核中")
    private String isMaster;

    //    @ApiModelProperty(value = "认证图片信息")
//    @JsonIgnore
    private String masterInfo;

    //    @ApiModelProperty(value = "认证信息")
//    @TableField(exist = false)
    private String token;

    /**
     * 用户是否已退出登录
     */
//    @TableField(exist = false)
    private Integer isLive;
    /**
     * 是否关注该用户 0:未关注
     */
//    @ApiModelProperty(value = "是否关注该用户 0:未关注 1:关注")
//    @TableField(exist = false)
    private Integer isFollow;
    //    @ApiModelProperty(value = "关注数")
//    @TableField(exist = false)
    private Integer followNum;
    //    @ApiModelProperty(value = "粉丝数")
//    @TableField(exist = false)
    private Integer fansNum;

    //    @TableField(exist = false)
    private Long refreshTime;



    @Override
    public void parse(JSONObject jsonObject) {
        id = JSONUtils.getInteger("id", jsonObject);
        img = JSONUtils.getString("img", jsonObject);
        nickname = JSONUtils.getString("nickname", jsonObject);
        description = JSONUtils.getString("description", jsonObject);
        password = JSONUtils.getString("password", jsonObject);
        salt = JSONUtils.getString("salt", jsonObject);
        phone = JSONUtils.getString("phone", jsonObject);
        sex = JSONUtils.getString("sex", jsonObject);
        openId = JSONUtils.getString("openId", jsonObject);
        qqId = JSONUtils.getString("qqId", jsonObject);
        wbId = JSONUtils.getString("wbId", jsonObject);
        email = JSONUtils.getString("email", jsonObject);
        updateTime = JSONUtils.getString("updateTime", jsonObject);
        createTime = JSONUtils.getString("createTime", jsonObject);
        lastLoginTime = JSONUtils.getString("lastLoginTime", jsonObject);
        status = JSONUtils.getString("status", jsonObject);
        username = JSONUtils.getString("username", jsonObject);
        signIn = JSONUtils.getInteger("signIn", jsonObject);
        idNumber = JSONUtils.getString("idNumber", jsonObject);
        isMaster = JSONUtils.getString("isMaster", jsonObject);
        isMember = JSONUtils.getString("isMember", jsonObject);
        masterInfo = JSONUtils.getString("masterInfo", jsonObject);
        token = JSONUtils.getString("token", jsonObject);
        isLive = JSONUtils.getInteger("isLive", jsonObject);
        isFollow = JSONUtils.getInteger("isFollow", jsonObject);
        followNum = JSONUtils.getInteger("followNum", jsonObject);
        fansNum = JSONUtils.getInteger("fansNum", jsonObject);
        refreshTime = JSONUtils.getLong("refreshTime", jsonObject);


    }
}
